package com.opoc.mapper;

import com.opoc.pojo.Enterprise;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.opoc.pojo.Enterprise_sql;

import java.awt.*;
import java.util.List;

/**
 * @program: opoc
 * @description:
 * @author: lyx
 * @create: 2023-10-22 15:44
 */
@Mapper

public interface EnterpriseMapper {
  /**
   * 企业基本信息
   */
  List<Enterprise> getEnterpriseBasicInfo(@Param("company_id") String company_id,
                                          @Param("company_name") String company_name,
                                          @Param("belong_region") String belong_region);

  /*
   * 查询企业信息
   * */
  List<Enterprise> findEnterpriseBasicInfo(@Param("company_id") String company_id,
                                          @Param("company_name") String company_name,
                                          @Param("belong_region") String belong_region);


//    void addEnterprise(Enterprise enterprise);
    void addEnterprises(Enterprise_sql enterprise_sql);
  /**
   * 删除企业*/
  void deleteEnterprise(@Param("company_id") String company_id);

  /**
   *通过企业id判断企业是否存在
   */
  @Select("select exists(select * from company where company_id = #{company_id})")
  Boolean validEnterpriseById(String company_id);

 /*
 * 获取企业全部信息
 * */
  @Select("select * from company where company_id=#{company_id}")
 Enterprise_sql getEnterpriseInfoById(String company_id);

  /**
   * 添加图片
   */
  void uploadImage(@Param("pool_distribution_path") String pool_distribution_path,
                   @Param("security_manage_net_path") String security_manage_net_path,
                   @Param("company_id") String company_id);

  /*根据company_id查找pool_id*/
    @Select("select pool_id from pool where company_id=#{company_id}")
  String findPIDbyCID(@Param("company_id")String company_id);

      /*
      *根据company_id查找admin_id */
      @Select("select admin_id from change_request where company_id=#{company_id}")
      String findAIDbyCID(@Param("company_id")String company_id);
/*
* 根据pool_id获得对应url*/
    @Select("select  pool_code from pool where pool_id=#{pool_id}")
 String findPURLbyPID1(@Param("pool_id")String pool_id);

    @Select("select  sewage_treatment_flow_chart from pool where pool_id=#{pool_id}")
    String findPURLbyPID2(@Param("pool_id")String pool_id);

}
